package server.main;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Server{
	
	public static void main(String[] args) throws IOException{
		new Server(40404);
	}

	private ServerSocket server;
	
	public Server(int port) throws IOException {
		server=new ServerSocket(port);
		System.out.println("Server run on: "+server);
		run();	
	}
	
	private void run() throws IOException{
		while(true){
			Socket sock=server.accept();
			sock.setKeepAlive(true);
			Thread thread=new Thread(new PacketHandler(sock));
			thread.start();
		}
	}

}